package com.fzj.example.design.visitor;

import com.fzj.example.design.adapter.ObjectAdapter;

public class VisitorPattern {
    public static void main(String[] args) {
        ObjectStructure objectStructure=new ObjectStructure();
        //两位老板
        objectStructure.add( new ConcreteElementA());
        objectStructure.add( new ConcreteElementB());
        Visitor visitor=new ConcreteVisitorA();
        //顾客-拜访
        objectStructure.accept(visitor);
        System.out.println("------------------------");
        visitor=new ConcreteVisitorB();
        objectStructure.accept(visitor);

    }
}
